<template>
  <el-form-item :label="componentDef.name" :prop="componentDef.code">
    <div v-if="formMode == 'edit' ">
      <el-select v-model="formData[componentDef.code]" placeholder="请选择" style="width: 100%;" size="medium " :clearable="true" >
        <el-option
          v-for="item in componentDef.options"
          :key="item.value"
          :label="item.label"
          :value="item.value">
        </el-option>
      </el-select>
    </div>
    <div v-else>
      <div v-text="showValue()"></div>
    </div>
  </el-form-item>
</template>

<script>
export default {
  name: 'SfSelect',
  props: {
    componentDef: {
      type: Object,
      required: true
    },
    formMode: {
      type: String,
      required: true
    },
    formData: {
      type: Object,
      required: true
    }
  },

  data(){
    return {
      



    }
  },
  methods: {
    showValue(){
      if (this.formData[this.componentDef.showCode] == null){
        return this.formData[this.componentDef.code]
      }
    }
  }
}


</script>